<template>
  <div class="me-view">
    <el-header class="view-header">
      <h2>我</h2>
    </el-header>
    <el-scrollbar class="view-content">
      <div class="profile">
        <el-avatar :size="80" src="https://picsum.photos/80/80?random=1" />
        <div class="profile-info">
          <div class="profile-name">用户名</div>
          <div class="profile-id">微信号: example123</div>
        </div>
      </div>

      <div class="menu-list">
        <div v-for="item in menuItems" :key="item.id" class="menu-item">
          <el-icon :size="20" class="menu-icon">
            <component :is="item.icon" />
          </el-icon>
          <span>{{ item.name }}</span>
          <el-icon :size="16" class="arrow-icon"><ArrowRight /></el-icon>
        </div>
      </div>
    </el-scrollbar>
  </div>
</template>

<script setup>
import { ArrowRight } from '@element-plus/icons-vue'
import {
  Wallet,
  Files,
  Picture,
  Setting
} from '@element-plus/icons-vue'

const menuItems = [
  { id: 1, name: '钱包', icon: Wallet },
  { id: 2, name: '收藏', icon: Files },
  { id: 3, name: '相册', icon: Picture },
  { id: 4, name: '设置', icon: Setting }
]
</script>

<style lang="scss" scoped>
.me-view {
  height: 100%;
  display: flex;
  flex-direction: column;

  .view-header {
    border-bottom: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    padding: 0 20px;
  }

  .view-content {
    flex: 1;
    padding: 10px;
  }

  .profile {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;

    .profile-info {
      margin-left: 15px;

      .profile-name {
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 5px;
      }

      .profile-id {
        font-size: 14px;
        color: #999;
      }
    }
  }

  .menu-list {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
  }

  .menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    position: relative;

    &:not(:last-child)::after {
      content: '';
      position: absolute;
      left: 50px;
      right: 0;
      bottom: 0;
      height: 1px;
      background-color: #f0f0f0;
    }

    &:hover {
      background-color: #f5f5f5;
    }

    .menu-icon {
      margin-right: 15px;
      color: #409eff;
    }

    .arrow-icon {
      margin-left: auto;
      color: #999;
    }
  }
}
</style>
